import { localStg } from "@/utils";

/** 获取token */
export function getToken() {
    return localStg.get("token") || "";
}

export function setLocalToken(token: string) {
  localStg.set("token", token);
}

export function setLocalUserInfo(user: Auth.UserInfo) {
  localStg.set("userInfo", user);
}

/** 获取用户信息 */
export function getUserInfo() {
    const emptyInfo: Auth.UserInfo = {
      id: '',
      name: '',
      mobile: '',
      post: '',
    };
    return localStg.get("userInfo") || emptyInfo;
}


/** 去除用户相关缓存 */
export function clearAuthStorage() {
    localStg.remove("token");
    localStg.remove("userInfo");
}
